<extend name="CigoAdminLib@Common/pageContent"/>
<block name="head-middle">
	<script type="text/javascript" src="__CIGO_ADMIN__/cigoos/list.js"></script>
</block>

<block name="tool-bar-btns">
	<a class="btn btn-primary" href="<<{:U('add')}>>">
		<i class="fa fa-plus-square"></i>
		添加根菜单
	</a>
</block>

<block name="content">
	<div class="panel panel-info">
		<div class="panel-heading">菜单列表</div>
		<table id="data-list" class="cigo-data-list table table-striped table-hover" url="<<{:U('getMenuTreeData')}>>">
			<tr>
				<th width="48%">菜单名称</th>
				<th width="15%">分组</th>
				<th width="7%">排序</th>
				<th width="30%">数据操作</th>
			</tr>
		</table>
	</div>
</block>

<block name="js-footer">
	<script type="text/javascript">
		function createTr(dataListView, itemSubViewList, listKey, dataItem, level, hasSubFlag, hasSubCls) {
			itemSubViewList.push(
				'<tr class="list-item" list-level="' + level + '">' +
				'   <td>' +
				'       ' + getTitleTab(level, "&nbsp;&nbsp;&nbsp;&nbsp;") +
				'       <i class="expand-icon cigo-iconfont ' + (hasSubFlag ? hasSubCls : '') + '"></i>' +
				'       <a href=\'<<{:U("edit", false, false)}>>' + Think.DEEP + 'id' + Think.DEEP + dataItem['id'] + '\' target="page_content">' +
				'           <i class="cigo-iconfont ' + dataItem['icon'] + '"></i>' +
				'           <span>&nbsp;' + dataItem['title'] + '</span>' +
				'       </a>' +
				'   </td>' +
				'   <td>' +
				'       ' + (dataItem['group'] == '' ? '' : (dataItem['group'] + '&nbsp;(' + dataItem['group_sort'] + ')')) +
				'   </td>' +
				'   <td>' +
				'       <input class="form-control cigo-edit quik-edit" cigo-edit-url=\'<<{:U("editValItem")}>>\' cigo-edit-val-item-key="sort" cigo-edit-val-item-val="' + dataItem['sort'] + '" cigo-edit-id="' + dataItem['id'] + '" type="text" value="' + dataItem['sort'] + '" />' +
				'   </td>' +
				'   <td>' +
				'       <a class="btn btn-default" href=\'<<{:U("add", false, false)}>>' + Think.DEEP + 'pid' + Think.DEEP + dataItem['id'] + Think.DEEP + 'ppath' + Think.DEEP + dataItem['path'] + Think.DEEP + 'ptitle' + Think.DEEP + dataItem['title'] + '\' ><i class="fa fa-plus-square-o"></i>子菜单</a>&nbsp;' +
				'       <a class="btn btn-default ajax-get" href=\'<<{:U("setStatus", false, false)}>>' + Think.DEEP + 'id' + Think.DEEP + dataItem['id'] + Think.DEEP + 'status' + Think.DEEP + Math.abs(1 - dataItem['status']) + Think.DEEP + 'ctrlTip' + Think.DEEP + show_status_label(dataItem['status'], ['启用', '禁用']) + '\' >' + show_status_label(dataItem['status'], ['启用', '禁用']) + '</a>&nbsp;' +
				'       <a class="btn btn-default" href=\'<<{:U("edit", false, false)}>>' + Think.DEEP + 'id' + Think.DEEP + dataItem['id'] + '\' >编辑</a>&nbsp;' +
				'       <a class="btn btn-default ajax-get confirm" href=\'<<{:U("setStatus", false, false)}>>' + Think.DEEP + 'id' + Think.DEEP + dataItem['id'] + Think.DEEP + 'status' + Think.DEEP + '-1' + Think.DEEP + 'ctrlTip' + Think.DEEP + '删除\' >删除</a>' +
				'   </td>' +
				'</tr>'
			);
		}

		$(function () {
			//操作列表
			var dataList = $('#data-list');
			refreshDataList(dataList, dataList.attr('url'), '', '', '', createTr, true);
		});
	</script>
</block>